﻿using AspectCore.Configuration;
using AspectCore.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebApplicationAOPNetCore
{
    public static class AopServices
    {
        public static void AddAopServices(this IServiceCollection services)
        {
            services.ConfigureDynamicProxy(config =>
            {
                config.Interceptors.AddTyped<CustomFilterAttribute>(); //添加过切点属性  全局拦截器
            });

            services.AddScoped<ICustomService, CustomService>();
        }
    }
}
